package educationaladministrationsystem.CSM.Controller.StudentAndTeacher.Student;

import educationaladministrationsystem.Result.Result;
import educationaladministrationsystem.CSM.Mapper.Service.StudentAndTeacher.Student.StudentGradeInquiryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("Student/GradeInquiry")
public class StudentGradeInquiryController {
    @Autowired
    private StudentGradeInquiryService studentGradeInquiryService;

    @GetMapping("/getCourseGrade")
    public Result getCourseGrade(@RequestParam String UID, @RequestParam int page, @RequestParam int pageNumber) {
        return Result.success(studentGradeInquiryService.getCourseGrade(UID, page, pageNumber));
    }

    @GetMapping("/getCPA")
    public Result getCPA(@RequestParam String studentId, @RequestParam String classId) {
        return Result.success(studentGradeInquiryService.getCPA(studentId, classId));
    }

    @GetMapping("/getPageSum")
    public Result getPageSum(@RequestParam String id, @RequestParam int pageNumber) {
        return Result.success(studentGradeInquiryService.getPageSum(id, pageNumber));
    }
}
